<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

/**
 * DISPENDA2BPD WEBSERVICE
 *
 * An close source application development
 *
 * @package		DISPENDA GIANYAR WEBSERVICE
 * @author		Andi Kurniawan
 * @copyright           PT. RUMAH LINUX YOGYAKARTA (c) 2013.
 * @license		nakamichikun@gmail.com
 * @follow		@nakamichikun
 * @since		Version 1.0
 * @filesource
 */
class Modnop extends CI_Model {

    function ambildatanop($query) {
        $data = $this->db->query($query);
        if ($data->num_rows > 0) {
            return $data->result();
        } else {
            return $data = array();
        }
    }

    function umum($query) {
        $data = $this->db->query($query);
        if ($data->num_rows > 0) {
            return $data->result();
        } else {
            return $data = array();
        }
    }

    function general($data) {
        $this->db->query($data);
    }

    function updStatusKirim($tahun, $nop) {
        $this->db->query("UPDATE SPPT_PENAMPUNGAN SET STATUS_KIRIM='1' WHERE THN_PAJAK_SPPT='" . $tahun . "' AND KD_PROPINSI||KD_DATI2||KD_KECAMATAN||KD_KELURAHAN||KD_BLOK||NO_URUT||KD_JNS_OP='" . $nop . "'");
    }

    function getNop($tahun) {
//        $data = $this->db->query("SELECT KD_PROPINSI,KD_DATI2,KD_KECAMATAN,KD_KELURAHAN,KD_BLOK,NO_URUT,KD_JNS_OP FROM sppt WHERE status_pembayaran_sppt=0 AND thn_pajak_sppt=" . $tahun . "");
        $data = $this->db->query("SELECT KD_PROPINSI,KD_DATI2,KD_KECAMATAN,KD_KELURAHAN,KD_BLOK,NO_URUT,KD_JNS_OP FROM sppt WHERE status_pembayaran_sppt=0 AND thn_pajak_sppt=" . $tahun . " AND ROWNUM <=3"); //uji coba mengambil 5 data
        if ($data->num_rows > 0) {
            return $data->result();
        } else {
            return array();
        }
    }

    function getDataWp($nop, $tahun) {
        $data = $this->db->query("SELECT KD_PROPINSI,KD_DATI2,KD_KECAMATAN,KD_KELURAHAN,KD_BLOK,NO_URUT,KD_JNS_OP,NM_WP_SPPT,PBB_YG_HARUS_DIBAYAR_SPPT,NPWP_SPPT,JLN_WP_SPPT,RT_WP_SPPT,RW_WP_SPPT,KELURAHAN_WP_SPPT,KOTA_WP_SPPT,KELURAHAN_WP_SPPT,THN_PAJAK_SPPT,TGL_JATUH_TEMPO_SPPT,LUAS_BUMI_SPPT,LUAS_BNG_SPPT,NJOP_BUMI_SPPT,NJOPTKP_SPPT,KELURAHAN_WP_SPPT FROM sppt WHERE KD_PROPINSI||KD_DATI2||KD_KECAMATAN||KD_KELURAHAN||KD_BLOK||NO_URUT||KD_JNS_OP=" . $nop . " AND status_pembayaran_sppt=0 AND thn_pajak_sppt=" . $tahun . "");
        if ($data->num_rows > 0) {
            return $data->result();
        } else {
            return array();
        }
    }

    function getDataWpPenetapan($nop, $tahun) {
        $data = $this->db->query("SELECT KD_PROPINSI,KD_DATI2,KD_KECAMATAN,KD_KELURAHAN,KD_BLOK,NO_URUT,KD_JNS_OP,NM_WP_SPPT,PBB_YG_HARUS_DIBAYAR_SPPT,NPWP_SPPT,JLN_WP_SPPT,RT_WP_SPPT,RW_WP_SPPT,KELURAHAN_WP_SPPT,KOTA_WP_SPPT,KELURAHAN_WP_SPPT,THN_PAJAK_SPPT,TGL_JATUH_TEMPO_SPPT,LUAS_BUMI_SPPT,LUAS_BNG_SPPT,NJOP_BUMI_SPPT,NJOPTKP_SPPT,KELURAHAN_WP_SPPT FROM sppt_penampungan WHERE KD_PROPINSI||KD_DATI2||KD_KECAMATAN||KD_KELURAHAN||KD_BLOK||NO_URUT||KD_JNS_OP=" . $nop . " AND status_pembayaran_sppt=0 AND thn_pajak_sppt=" . $tahun . "");
        if ($data->num_rows > 0) {
            return $data->result();
        } else {
            return array();
        }
    }

}
